<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Edit Scheduling</title>
<link rel="stylesheet" type="text/css" href="component/jquery-easyui-1.5.1/themes/default/easyui.css">
<link rel="stylesheet" type="text/css" href="component/jquery-easyui-1.5.1/themes/icon.css">
<link rel="stylesheet" type="text/css" href="../demo.css">
<script type="text/javascript" src="component/jquery-easyui-1.5.1/jquery.min.js"></script>
<script type="text/javascript" src="component/jquery-easyui-1.5.1/jquery.easyui.min.js"></script>
</head>

<script type="text/javascript">
function saves(){
	$.ajax({
		 type: "post",
		    url:"updateRole.action",
		    data:$('#updateRole').serialize()
		    +"&addDate="+$('#addDate').datebox('getValue')
		    +"&accessName="+$('#accessName').datebox('getValue'),
	    async: false,
	    error: function(request) {
	      alert("抱歉,更新失败!");
	    },
	    success: function(data) {
	    	alert("更新成功！");
	    	window.location.href = 'Page.action?number='+${number};
	    }
	});
}
</script>

<body>
<table border="1">
	<tr>		
			<td colspan="1">RoleName</td>
			<td colspan="1">RoleDescription</td>
			<td colspan="1">AddDate</td>
			<td colspan="1">Access</td>
	</tr>
	<form id="updateRole" action="updateRole.action" method="POST" >
		<tr>
			<input id="roleId" name="roleId" type="hidden" value="${role.roleId}"/>
			<td colspan="1"><input id="roleName" name="RoleName" value="${role.roleName}" type="text"></td>
			<td colspan="1"><input id="roleDescription" name="RoleDescription" value="${role.roleDescription}" type="text"/></td>
			<td colspan="1"><input class="easyui-datebox"  id="addDate" name=addDate value="${role.addDate}" required="required" type="text"/></td>
			<td colspan="1"><select class="easyui-combobox" id="accessName" name="accessName" style="width:50%;">
								<c:forEach items="${accessList}" var="list">
									<option <c:if test="${role.accessName==list.accessName}">selected="selected"</c:if>value="${list.accessName}">${list.accessName}</option>
								</c:forEach>
							</select>
						</td>				
		</tr>
		<input onclick="saves()" type="button" value="Save"/>
	</form>	
</table>

</body>
</html>